package com.test.sdk.provider.util;

import java.util.Random;

public class AccountUtil {

    public static boolean checkMobile(String phone) {
        if (phone == null || phone.trim().length() == 0) {
            return false;
        }
        String reg = "^1[3-9]\\d{9}$";
        return phone.matches(reg);
    }
    public static boolean checkPassword(String password) {
        if (password == null || password.trim().length() == 0) {
            return false;
        }
        String reg = "^[\\da-zA-Z]{6,20}$";
        return password.matches(reg);
    }

    public static void main(String[] args) {
        System.out.println(checkPassword("4eds_f4"));
    }

    public static String getRandomCode(int len){
        StringBuilder builder=new StringBuilder();
        Random random=new Random();
        for (int i = 0; i < len; i++) {
            int num=random.nextInt(10);
            builder.append(num);
        }
        return builder.toString();
    }
}
